package presentacion;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class VentanaFuncionalidades extends javax.swing.JFrame {

    private JFrame frame;
    
    public VentanaFuncionalidades(String permiso) {
        initComponents();
        if(permiso.equals("ANALISTA1")){
            MercadosBTN.setVisible(true);
            CompaniasBTN.setVisible(true);
            AccionesBTN.setVisible(true);
            PreciosBTN.setVisible(true);
            EstadisticasBTN.setVisible(true);
            RetornosBTN.setVisible(true);
            JOptionPane.showMessageDialog(frame, "Bienvenido Profesor" , "Bienvenida", JOptionPane.OK_OPTION);
        }
        if(permiso.equals("ANALISTA2")){
            MercadosBTN.setVisible(false);
            CompaniasBTN.setVisible(true);
            AccionesBTN.setVisible(true);
            PreciosBTN.setVisible(false);
            EstadisticasBTN.setVisible(true);
            RetornosBTN.setVisible(false);
            JOptionPane.showMessageDialog(frame, "Bienvenido Analista2" , "Bienvenida", JOptionPane.OK_OPTION);
        }
        if(permiso.equals("TECNICO")){
            MercadosBTN.setVisible(false);
            CompaniasBTN.setVisible(false);
            AccionesBTN.setVisible(true);
            PreciosBTN.setVisible(false);
            EstadisticasBTN.setVisible(true);
            RetornosBTN.setVisible(false);
            JOptionPane.showMessageDialog(frame, "Bienvenido Tecnico" , "Bienvenida", JOptionPane.OK_OPTION);
        }
    }

    private VentanaFuncionalidades() {
        
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        MercadosBTN = new javax.swing.JButton();
        CompaniasBTN = new javax.swing.JButton();
        AccionesBTN = new javax.swing.JButton();
        PreciosBTN = new javax.swing.JButton();
        EstadisticasBTN = new javax.swing.JButton();
        RetornosBTN = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        MercadosBTN.setText("Mercados");
        MercadosBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MercadosBTNActionPerformed(evt);
            }
        });

        CompaniasBTN.setText("Compañias");
        CompaniasBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CompaniasBTNActionPerformed(evt);
            }
        });

        AccionesBTN.setText("Acciones");
        AccionesBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AccionesBTNActionPerformed(evt);
            }
        });

        PreciosBTN.setText("Precios de Acciones");
        PreciosBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PreciosBTNActionPerformed(evt);
            }
        });

        EstadisticasBTN.setText("Estadisticas");
        EstadisticasBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EstadisticasBTNActionPerformed(evt);
            }
        });

        RetornosBTN.setText("Retornos por accion");
        RetornosBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RetornosBTNActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(131, 131, 131)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(RetornosBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(PreciosBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(AccionesBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(EstadisticasBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(MercadosBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(CompaniasBTN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(MercadosBTN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CompaniasBTN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(AccionesBTN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(PreciosBTN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(EstadisticasBTN)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RetornosBTN)
                .addContainerGap(49, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void MercadosBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MercadosBTNActionPerformed
        CRUDMercados mercados = new CRUDMercados();
        mercados.setLocationRelativeTo(null);
        mercados.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_MercadosBTNActionPerformed

    private void PreciosBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PreciosBTNActionPerformed
        CRUDPrecios precios = new CRUDPrecios();
        precios.setLocationRelativeTo(null);
        precios.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_PreciosBTNActionPerformed

    private void RetornosBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RetornosBTNActionPerformed
        RetornosAccion retornos = new RetornosAccion();
        retornos.setLocationRelativeTo(null);
        retornos.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_RetornosBTNActionPerformed

    private void EstadisticasBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EstadisticasBTNActionPerformed
        Estadisticas estadisticas = new Estadisticas();
        estadisticas.setLocationRelativeTo(null);
        estadisticas.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_EstadisticasBTNActionPerformed

    private void CompaniasBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CompaniasBTNActionPerformed
        CRUDCompanias companias = new CRUDCompanias();
        companias.setLocationRelativeTo(null);
        companias.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_CompaniasBTNActionPerformed

    private void AccionesBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AccionesBTNActionPerformed
        CRUDAcciones acciones = new CRUDAcciones();
        acciones.setLocationRelativeTo(null);
        acciones.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_AccionesBTNActionPerformed
    public static void main(String args[]) {
              new VentanaFuncionalidades().setVisible(true);   
        }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AccionesBTN;
    private javax.swing.JButton CompaniasBTN;
    private javax.swing.JButton EstadisticasBTN;
    private javax.swing.JButton MercadosBTN;
    private javax.swing.JButton PreciosBTN;
    private javax.swing.JButton RetornosBTN;
    // End of variables declaration//GEN-END:variables
}
